package idv.loveloser.mobilemoodle;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ForumManagerAdapter extends BaseAdapter{
	private Context mContext;
	private List<MdlForum> forums;
	private LayoutInflater mInflater;
	public ForumManagerAdapter(Context context){
		this.mContext=context;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return forums.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ForumHolder holder =null;
		this.mInflater = LayoutInflater.from(mContext); 
		if (convertView == null) {
			holder=new ForumHolder();   
			convertView = mInflater.inflate(R.layout.forum_holder, null);
			holder.forumTextView= (TextView) convertView.findViewById(R.id.forumDescription);
//			holder.courseTextView = (TextView) convertView.findViewById(R.id.courseDescription);
			convertView.setTag(holder); 
		}else{
			holder = (ForumHolder)convertView.getTag(); 
		}
		holder.forumTextView.setText(forums.get(position).getName());
		return convertView;
	}
	public List<MdlForum> getForums() {
		return forums;
	}
	public void setForums(List<MdlForum> forums) {
		this.forums = forums;
	}

}
